<?php

class Admin extends APPS_Controller {
	//private $data; 
	public $data; 
	
  	function __construct() {
		parent::__construct();
		header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
		header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
		header("If-Modified-Since: Mon, 22 Jan 2008 00:00:00 GMT");
		header("Cache-Control: no-store, no-cache, must-revalidate");
		header("Cache-Control: post-check=0, pre-check=0", false);
		header("Cache-Control: private");
		header("Pragma: no-cache");

		$this->load->library('cezpdf');
		$this->load->model('adminModel');
		$this->data['title'] 	= $this->site['title'];
		$this->data['user'] 	= $this->session->userdata('data');
		
		$this->site['assets']	= $this->site['site'] .'assets/admin/';
		$this->smarty->assign('site', $this->site);	
	}
		
	function index() {
		$this->login();
	}

	function login(){
        $this->data['title']	.= " :: Administration";

		$this->smarty->assign('data', $this->data);
		$this->smarty->display('admin/pages/login.tpl');
	}

	function logout() 	{
		$this->session->unset_userdata('data');
		$this->session->sess_destroy();
		redirect('admin');
	}
	
	function dashboard(){
		$this->data['title'] 	.= " :: Dashboard";

		$this->smarty->assign('data', $this->data);
		$this->smarty->display('admin/dashboard/home.tpl');
	}
	
	function content($order='contentID', $sort='asc', $page=1, $limit=10){
        $this->data['title'] 	.= " :: Content Manager";

		$offset = $this->setPaging($page, $limit, $this->adminModel->getContent());
		$this->data['rows'] 	= $this->adminModel->getContent($order, $sort, $limit, $offset);
		$this->data['order']  	= $order;
		$this->data['sort']  	= $sort;
		$this->data['sort_contentID']  = "asc";

		$fields = array('contentID', 'title', 'state', 'created');
		  
		foreach ($fields as $key=>$value) {
			$this->data['sort_'.$value]  = "none";
		}
 
		$this->smarty->assign('data', $this->data);
		$this->smarty->display('admin/pages/content.tpl');
	}


	function contentForm($contentID=0, $order='id', $sort='asc', $page=1, $limit=10, $msg=""){
		$this->data['order'] 		= $order;
		$this->data['sort'] 		= $sort;
		$this->data['page'] 		= $page;
		$this->data['limit'] 		= $limit;
		$this->data['msg'] 			= $msg;

		$this->data['back']			= $this->site['site']."admin/content/$order/$sort/$page/$limit" ;
		$this->data['row'] 			= $this->adminModel->getContentForm( $contentID );
		$this->data['r_img'] 		= $this->adminModel->getImage( $contentID );
		

		if (count($this->data['row'])==0) {
			$this->data['row']['contentID']	= "0";
			$this->data['row']['title'] 	= "";
			$this->data['row']['state'] 	= "0";
			$this->data['row']['isPublish'] 	= "";
			$this->data['row']['isUnPublish'] 	= "";
			
			$this->data['row']['img_1'] = "";
			$this->data['row']['img_2'] = "";
			$this->data['row']['img_3'] = "";
			
		} else {
			if ($this->data['row']['state'] == "1") {
				$this->data['row']['isPublish'] 	= " checked ";
			} else {
				$this->data['row']['isUnPublish'] 	= " checked ";
			}
			
			if ($this->data['row']['slideshow'] == "1") {
				$this->data['row']['isSlideshow'] 	= " checked ";
			} else {
				$this->data['row']['isSlideshow'] 	= "";
			}
			$this->data['row']['img_1'] = count($this->adminModel->getImageHeadline( $contentID )) > 0 ? $this->adminModel->getImageHeadline( $contentID ) : "";
			$this->data['row']['img_2'] = count($this->adminModel->getImage1( $contentID )) > 0 ? $this->adminModel->getImage1( $contentID ) : "";
			$this->data['row']['img_3'] = count($this->adminModel->getImage2( $contentID )) > 0 ? $this->adminModel->getImage2( $contentID ) : "";
		}
		
		$this->smarty->assign('data', $this->data);
		$this->smarty->display('admin/pages/content_form.tpl');
	}


	function fasilitas($order='contentID', $sort='asc', $page=1, $limit=10){
        $this->data['title'] 	.= " :: Fasilitas";

		$offset = $this->setPaging($page, $limit, $this->adminModel->getFasilitas());
		$this->data['rows'] 	= $this->adminModel->getFasilitas($order, $sort, $limit, $offset);
		$this->data['order']  	= $order;
		$this->data['sort']  	= $sort;
		$this->data['sort_contentID']  = "asc";

		$fields = array('contentID', 'title', 'state', 'created');
		  
		foreach ($fields as $key=>$value) {
			$this->data['sort_'.$value]  = "none";
		}
 
		$this->smarty->assign('data', $this->data);
		$this->smarty->display('admin/pages/fasilitas.tpl');
	}


	function fasilitasForm($contentID=0, $order='id', $sort='asc', $page=1, $limit=10, $msg=""){
		$this->data['order'] 		= $order;
		$this->data['sort'] 		= $sort;
		$this->data['page'] 		= $page;
		$this->data['limit'] 		= $limit;
		$this->data['msg'] 			= $msg;

		$this->data['back']			= $this->site['site']."admin/fasilitas/$order/$sort/$page/$limit" ;
		$this->data['row'] 			= $this->adminModel->getContentForm( $contentID );
		
		
		if (count($this->data['row'])==0) {
			$this->data['row']['contentID']	= "0";
			$this->data['row']['title'] 	= "";
			$this->data['row']['state'] 	= "0";
			$this->data['row']['isPublish'] 	= "";
			$this->data['row']['isUnPublish'] 	= "";
			
			$this->data['row']['img_1'] 	= "";
		} else {
			if ($this->data['row']['state'] == "1") {
				$this->data['row']['isPublish'] 	= " checked ";
			} else {
				$this->data['row']['isUnPublish'] 	= " checked ";
			}
			
			if ($this->data['row']['slideshow'] == "1") {
				$this->data['row']['isSlideshow'] 	= " checked ";
			} else {
				$this->data['row']['isSlideshow'] 	= "";
			}
			$this->data['row']['img_1'] = count($this->adminModel->getImageHeadline( $contentID )) > 0 ? $this->adminModel->getImageHeadline( $contentID ) : "";

		}
		
		$this->smarty->assign('data', $this->data);
		$this->smarty->display('admin/pages/fasilitas_form.tpl');
	}


	function pejabat($order='id', $sort='asc', $page=1, $limit=50){
        $this->data['title'] 	.= " :: Pejabat";

		$offset = $this->setPaging($page, $limit, $this->adminModel->getPejabat());
		$this->data['rows'] 	= $this->adminModel->getPejabat($order, $sort, $limit, $offset);
		$this->data['order']  	= $order;
		$this->data['sort']  	= $sort;
		$this->data['sort_contentID']  = "asc";

		$fields = array('contentID', 'nama', 'jabatan', 'state', 'created');
		  
		foreach ($fields as $key=>$value) {
			$this->data['sort_'.$value]  = "none";
		}
 
		$this->smarty->assign('data', $this->data);
		$this->smarty->display('admin/pages/pejabat.tpl');
	}


	function pejabatForm($contentID=0, $order='id', $sort='asc', $page=1, $limit=10, $msg=""){
		$this->data['order'] 		= $order;
		$this->data['sort'] 		= $sort;
		$this->data['page'] 		= $page;
		$this->data['limit'] 		= $limit;
		$this->data['msg'] 			= $msg;

		$this->data['back']			= $this->site['site']."admin/pejabat/$order/$sort/$page/$limit" ;
		$this->data['row'] 			= $this->adminModel->getPejabatForm( $contentID );
		
		
		if (count($this->data['row'])==0) {
			$this->data['row']['contentID']	= "0";
			$this->data['row']['title'] 	= "";
			$this->data['row']['state'] 	= "0";
			$this->data['row']['isPublish'] 	= "";
			$this->data['row']['isUnPublish'] 	= "";
			
			$this->data['row']['img_1'] 	= "";
		} else {
			if ($this->data['row']['state'] == "1") {
				$this->data['row']['isPublish'] 	= " checked ";
			} else {
				$this->data['row']['isUnPublish'] 	= " checked ";
			}
			
		}
		
		$this->smarty->assign('data', $this->data);
		$this->smarty->display('admin/pages/pejabat_form.tpl');
	}

	function pengajar($order='id', $sort='asc', $page=1, $limit=20){
        $this->data['title'] 	.= " :: Pengajar";

		$offset = $this->setPaging($page, $limit, $this->adminModel->getPengajar());
		$this->data['rows'] 	= $this->adminModel->getPengajar($order, $sort, $limit, $offset);
		$this->data['order']  	= $order;
		$this->data['sort']  	= $sort;
		$this->data['sort_contentID']  = "asc";

		$fields = array('contentID', 'nippns', 'nama', 'state', 'created');
		  
		foreach ($fields as $key=>$value) {
			$this->data['sort_'.$value]  = "none";
		}
 
		$this->smarty->assign('data', $this->data);
		$this->smarty->display('admin/pages/pengajar.tpl');
	}


	function pengajarForm($contentID=0, $order='id', $sort='asc', $page=1, $limit=10, $msg=""){
		$this->data['order'] 		= $order;
		$this->data['sort'] 		= $sort;
		$this->data['page'] 		= $page;
		$this->data['limit'] 		= $limit;
		$this->data['msg'] 			= $msg;

		$this->data['back']			= $this->site['site']."admin/pengajar/$order/$sort/$page/$limit" ;
		$this->data['row'] 			= $this->adminModel->getPengajarForm( $contentID );
		
		echo count($this->data['row']);
		if (count($this->data['row'])==0) {
			$this->data['row']['id']	= "0";
			$this->data['row']['nama'] 	= "";
			$this->data['row']['state'] 	= "0";
			$this->data['row']['nippns'] 	= "";
			$this->data['row']['isPublish'] 	= "";
			$this->data['row']['isUnPublish'] 	= "";
		} else {
			if ($this->data['row']['state'] == "1") {
				$this->data['row']['isPublish'] 	= " checked ";
			} else {
				$this->data['row']['isUnPublish'] 	= " checked ";
			}
			
		}
		
		$this->smarty->assign('data', $this->data);
		$this->smarty->display('admin/pages/pengajar_form.tpl');
	}

	function user($order='user_id', $sort='asc', $page=1, $limit=10){
        $this->data['title'] 	.= " :: User";

		$offset = $this->setPaging($page, $limit, $this->adminModel->getUser());
		$this->data['rows'] 	= $this->adminModel->getUser($order, $sort, $limit, $offset);
		$this->data['order']  	= $order;
		$this->data['sort']  	= $sort;
		$this->data['sort_contentID']  = "asc";

		$fields = array('user_id', 'user_name', 'name', 'state', 'created');
		  
		foreach ($fields as $key=>$value) {
			$this->data['sort_'.$value]  = "none";
		}
 
		$this->smarty->assign('data', $this->data);
		$this->smarty->display('admin/pages/user.tpl');
	}


	function userForm($contentID=0, $order='user_id', $sort='asc', $page=1, $limit=10, $msg=""){
		$this->data['order'] 		= $order;
		$this->data['sort'] 		= $sort;
		$this->data['page'] 		= $page;
		$this->data['limit'] 		= $limit;
		$this->data['msg'] 			= $msg;

		$this->data['back']			= $this->site['site']."admin/user/$order/$sort/$page/$limit" ;
		$this->data['row'] 			= $this->adminModel->getUserForm( $contentID );
		$this->data['acl'] 	= $this->adminModel->getAcl();
		
		if (count($this->data['row'])==0) {
			$this->data['row']['user_id']	= "0";
			$this->data['row']['name'] 	= "";
			$this->data['row']['user_name'] 	= "";
			$this->data['row']['password'] 	= "";
			$this->data['row']['acl_id'] 	= "";			
			$this->data['row']['state'] 	= "0";
			$this->data['row']['isPublish'] 	= "";
			$this->data['row']['isUnPublish'] 	= "";
			
		} else {
			if ($this->data['row']['state'] == "1") {
				$this->data['row']['isPublish'] 	= " checked ";
			} else {
				$this->data['row']['isUnPublish'] 	= " checked ";
			}
		}
		
		$this->smarty->assign('data', $this->data);
		$this->smarty->display('admin/pages/user_form.tpl');
	}	
	
	function section($order='sectionid', $sort='asc', $page=1, $limit=10){
        $this->data['title'] 	.= " :: Section";

		$offset = $this->setPaging($page, $limit, $this->adminModel->getSection());
		$this->data['rows'] 	= $this->adminModel->getSection($order, $sort, $limit, $offset);
		$this->data['order']  	= $order;
		$this->data['sort']  	= $sort;
		$this->data['sort_sectionID']  = "asc";

		$fields = array('sectionid', 'title',  'state', 'created');
		  
		foreach ($fields as $key=>$value) {
			$this->data['sort_'.$value]  = "none";
		}
 
		$this->smarty->assign('data', $this->data);
		$this->smarty->display('admin/pages/section.tpl');
	}


	function sectionForm($contentID=0, $order='sectionid', $sort='asc', $page=1, $limit=10, $msg=""){
		$this->data['order'] 		= $order;
		$this->data['sort'] 		= $sort;
		$this->data['page'] 		= $page;
		$this->data['limit'] 		= $limit;
		$this->data['msg'] 			= $msg;

		$this->data['back']			= $this->site['site']."admin/section/$order/$sort/$page/$limit" ;
		$this->data['row'] 			= $this->adminModel->getSectionForm( $contentID );
		
		if (count($this->data['row'])==0) {
			$this->data['row']['sectionID']	= "0";
			$this->data['row']['title'] 	= "";
			$this->data['row']['state'] 	= "0";
			$this->data['row']['isPublish'] 	= "";
			$this->data['row']['isUnPublish'] 	= "";
			
		} else {
			if ($this->data['row']['state'] == "1") {
				$this->data['row']['isPublish'] 	= " checked ";
			} else {
				$this->data['row']['isUnPublish'] 	= " checked ";
			}
		}
		
		$this->smarty->assign('data', $this->data);
		$this->smarty->display('admin/pages/section_form.tpl');
	}		
	

	function category($order='categoryid', $sort='asc', $page=1, $limit=10){
        $this->data['title'] 	.= " :: Category";

		$offset = $this->setPaging($page, $limit, $this->adminModel->getCategory());
		$this->data['rows'] 	= $this->adminModel->getCategory($order, $sort, $limit, $offset);
		$this->data['order']  	= $order;
		$this->data['sort']  	= $sort;
		$this->data['sort_categoryID']  = "asc";
		
		$fields = array('categoryid', 'title',  'section', 'state', 'created');
		  
		foreach ($fields as $key=>$value) {
			$this->data['sort_'.$value]  = "none";
		}
 
		$this->smarty->assign('data', $this->data);
		$this->smarty->display('admin/pages/category.tpl');
	}


	function categoryForm($contentID=0, $order='categoryid', $sort='asc', $page=1, $limit=10, $msg=""){
		$this->data['order'] 		= $order;
		$this->data['sort'] 		= $sort;
		$this->data['page'] 		= $page;
		$this->data['limit'] 		= $limit;
		$this->data['msg'] 			= $msg;

		$this->data['back']			= $this->site['site']."admin/category/$order/$sort/$page/$limit" ;
		$this->data['row'] 			= $this->adminModel->getCategoryForm( $contentID );
		
		$this->data['section'] 		= $this->adminModel->getSectionRef();

		if (count($this->data['row'])==0) {
			$this->data['row']['categoryID']	= "0";
			$this->data['row']['sectionid']	= "0";
			$this->data['row']['title'] 	= "";
			$this->data['row']['state'] 	= "0";
			$this->data['row']['isPublish'] 	= "";
			$this->data['row']['isUnPublish'] 	= "";
			
		} else {
			if ($this->data['row']['state'] == "1") {
				$this->data['row']['isPublish'] 	= " checked ";
			} else {
				$this->data['row']['isUnPublish'] 	= " checked ";
			}
		}
		
		$this->smarty->assign('data', $this->data);
		$this->smarty->display('admin/pages/category_form.tpl');
	}	

	function berita($order='contentID', $sort='asc', $page=1, $limit=10){
		$limit  = 10;
		$offset = $this->setPaging($page, $limit, $this->adminModel->getBerita());
		$this->data['rows'] 	= $this->adminModel->getBerita($order, $sort, $limit, $offset);
		$this->data['order']  	= $order;
		$this->data['sort']  	= $sort;
		$this->data['sort_contentID']  = "asc";

		$fields = array('contentID', 'title', 'state', 'created');
		  
		foreach ($fields as $key=>$value) {
			$this->data['sort_'.$value]  = "none";
		}
 
		$this->smarty->assign('data', $this->data);
		$this->smarty->display('admin/dashboard/berita.tpl');
	}		
	
	function beritaEdit($contentID=0, $order='id', $sort='asc', $page=1, $limit=10, $msg=""){
		$this->data['order'] 		= $order;
		$this->data['sort'] 		= $sort;
		$this->data['page'] 		= $page;
		$this->data['limit'] 		= $limit;
		$this->data['msg'] 			= $msg;

		$this->data['back']			= $this->site['site']."admin/berita/$order/$sort/$page/$limit" ;
		$this->data['row'] 			= $this->adminModel->getBeritaEdit( $contentID );
		$this->data['r_img'] 		= $this->adminModel->getImage( $contentID );
		$this->data['row']['isPublish'] 	= "";
		$this->data['row']['isUnPublish'] 	= "";
		if (count($this->data['r_img']==0)) {
			//
		} else {
			$i = 1;
			foreach ($this->data['r_img']['img'] as $key=>$value) {
				$this->data['img_'.$i]  = $value;
				$i++;
			}
		}
		
		if (count($this->data['row'])==0) {
			$this->data['row']['contentID']	= "0";
			$this->data['row']['title'] 	= "";
			$this->data['row']['state'] 	= "0";
			
			$this->data['row']['img_1'] 	= "";
			$this->data['row']['img_2'] 	= "";
			$this->data['row']['img_3'] 	= "";
			$this->data['row']['img_4'] 	= "";
			$this->data['row']['img_5'] 	= "";
			
		} else {
			if ($this->data['row']['state'] == "1") {
				$this->data['row']['isPublish'] 	= " checked ";
			} else {
				$this->data['row']['isUnPublish'] 	= " checked ";
			}
			
			if ($this->data['row']['slideshow'] == "1") {
				$this->data['row']['isSlideshow'] 	= " checked ";
			} else {
				$this->data['row']['isSlideshow'] 	= "";
			}
		}
		
		$this->smarty->assign('data', $this->data);
		$this->smarty->display('admin/dashboard/berita_edit.tpl');
	}

	function test() {
		//$this->clear();
				$this->session->unset_userdata('site');
		echo 'after';
		//$this->session->unset_userdata('data');

	}
	
	function kuliah($order='id', $sort='asc', $page=1, $limit=20){
        $this->data['title'] 	.= " :: Kuliah";

		$offset = $this->setPaging($page, $limit, $this->adminModel->getKuliah());
		$this->data['rows'] 	= $this->adminModel->getKuliah($order, $sort, $limit, $offset);
		$this->data['order']  	= $order;
		$this->data['sort']  	= $sort;
		$this->data['sort_id']  = "asc";

		$fields = array('nama', 'sks', 'semester', 'id');
		  
		foreach ($fields as $key=>$value) {
			$this->data['sort_'.$value]  = "none";
		}
 
		$this->smarty->assign('data', $this->data);
		$this->smarty->display('admin/pages/kuliah.tpl');
	}
	
	/* mi2208 */
	function kuliahForm($id=0, $order='id', $sort='asc', $page=1, $limit=10, $msg=""){
		$this->data['order'] 		= $order;
		$this->data['sort'] 		= $sort;
		$this->data['page'] 		= $page;
		$this->data['limit'] 		= $limit;
		$this->data['msg'] 			= $msg;

		$this->data['back']			= $this->site['site']."admin/kuliah/$order/$sort/$page/$limit" ;
		$this->data['row'] 			= $this->adminModel->getKuliahForm( $id );
		
		// echo count($this->data['row']);
		if (count($this->data['row'])==0) {
			$this->data['row']['id']	= "0";
			$this->data['row']['nama'] 	= "";
			$this->data['row']['sks'] 	= "0";
			$this->data['row']['semester'] 	= "";
			$this->data['row']['jenis'] 	= "";
			$this->data['row']['isTeori'] 	= "";
			$this->data['row']['isPraktek'] 	= "";
		} else {
			if ($this->data['row']['jenis'] == "1") {
				$this->data['row']['isPraktek'] 	= " checked ";
			} else {
				$this->data['row']['isTeori'] 	= " checked ";
			}
			
		}
		
		$this->smarty->assign('data', $this->data);
		$this->smarty->display('admin/pages/kuliah_form.tpl');
	}
	
	/* 06:59 not uploaded */
	function silabus($order='semester', $sort='desc', $page=1, $limit=20){
        $this->data['title'] 	.= " :: Silabus";

		$offset = $this->setPaging($page, $limit, $this->adminModel->getSilabus());
		$this->data['rows'] 	= $this->adminModel->getSilabus($order, $sort, $limit, $offset);
		$this->data['order']  	= $order;
		$this->data['sort']  	= $sort;
		$this->data['sort_id']  = "asc";

		$fields = array('mataKuliah', 'jenis',  'semester', 'sks', 'kode');
		  
		foreach ($fields as $key=>$value) {
			$this->data['sort_'.$value]  = "none";
		}
 
		$this->smarty->assign('data', $this->data);
		$this->smarty->display('admin/pages/silabus.tpl');
	}
	
	function silabusForm($id=0, $order='id', $sort='asc', $page=1, $limit=10, $msg=""){
		$this->data['order'] 		= $order;
		$this->data['sort'] 		= $sort;
		$this->data['page'] 		= $page;
		$this->data['limit'] 		= $limit;
		$this->data['msg'] 			= $msg;

		$this->data['back']			= $this->site['site']."admin/silabus/$order/$sort/$page/$limit" ;
		$this->data['row'] 			= $this->adminModel->getSilabusForm( $id );
		
		// echo count($this->data['row']);
		if (count($this->data['row'])==0) {
			$this->data['row']['id']	= "0";
			$this->data['row']['mataKuliah'] 	= "";
			$this->data['row']['sks'] 	= "0";
			$this->data['row']['semester'] 	= "";
			$this->data['row']['jenis'] 	= "";
			$this->data['row']['isTeori'] 	= "";
			$this->data['row']['isPraktek'] 	= "";
			$this->data['row']['jurusan'] = "Klimatologi";
		} else {
			if ($this->data['row']['jenis'] == "Praktek") {
				$this->data['row']['isPraktek'] 	= " checked ";
			} else {
				$this->data['row']['isTeori'] 	= " checked ";
			}
			
		}
		
		$this->smarty->assign('data', $this->data);
		$this->smarty->display('admin/pages/silabus_form.tpl');
	}
	
	
	/* 06:59 */
	
	/* Daftar Mahasiswa 220810 22:16 */
	function mahasiswa($order='nama', $sort='desc', $page=1, $limit=20){
        $this->data['title'] 	.= " :: Daftar Mahasiswa";

		$offset = $this->setPaging($page, $limit, $this->adminModel->getMahasiswa());
		$this->data['rows'] 	= $this->adminModel->getMahasiswa($order, $sort, $limit, $offset);
		$this->data['order']  	= $order;
		$this->data['sort']  	= $sort;
		$this->data['sort_id']  = "asc";

		$fields = array('id', 'nama',  'jurusan', 'angkatan', 'kelas');
		  
		foreach ($fields as $key=>$value) {
			$this->data['sort_'.$value]  = "none";
		}
 
		$this->smarty->assign('data', $this->data);
		$this->smarty->display('admin/pages/mahasiswa.tpl');
	}
	
	function mahasiswaForm($id=0, $order='id', $sort='asc', $page=1, $limit=10, $msg=""){
		$this->data['order'] 		= $order;
		$this->data['sort'] 		= $sort;
		$this->data['page'] 		= $page;
		$this->data['limit'] 		= $limit;
		$this->data['msg'] 			= $msg;

		$this->data['back']			= $this->site['site']."admin/mahasiswa/$order/$sort/$page/$limit" ;
		$this->data['row'] 			= $this->adminModel->getMahasiswaForm( $id );
		$this->data['rowj']			= $this->adminModel->getJurusan();
		
		// echo count($this->data['row']);
		if (count($this->data['row'])==0) {
			$this->data['row']['id']	= "0";
			$this->data['row']['nama'] 	= "";	
			$this->data['row']['jurusan'] 	= "";
			$this->data['row']['angkatan'] 	= "";
			$this->data['row']['kelas'] 	= "";
		} else {
			//
		}
		
		$this->smarty->assign('data', $this->data);
		$this->smarty->display('admin/pages/mahasiswa_form.tpl');
	}
	/* end here Daftar Mahasiswa */
	
	/* end here mi2208 */
	
	/* Kelulusan 230810 01:55 */
	function lulus($order='nama', $sort='desc', $page=1, $limit=20){
        $this->data['title'] 	.= " :: Kelulusan";

		$offset = $this->setPaging($page, $limit, $this->adminModel->getLulus());
		$this->data['rows'] 	= $this->adminModel->getLulus($order, $sort, $limit, $offset);
		$this->data['order']  	= $order;
		$this->data['sort']  	= $sort;
		$this->data['sort_id']  = "asc";

		$fields = array('id', 'nama',  'jurusan');
		  
		foreach ($fields as $key=>$value) {
			$this->data['sort_'.$value]  = "none";
		}
 
		$this->smarty->assign('data', $this->data);
		$this->smarty->display('admin/pages/lulus.tpl');
	}
	
	function lulusForm($id=0, $order='id', $sort='asc', $page=1, $limit=10, $msg=""){
		$this->data['order'] 		= $order;
		$this->data['sort'] 		= $sort;
		$this->data['page'] 		= $page;
		$this->data['limit'] 		= $limit;
		$this->data['msg'] 			= $msg;

		$this->data['back']			= $this->site['site']."admin/lulus/$order/$sort/$page/$limit" ;
		$this->data['row'] 			= $this->adminModel->getLulusForm( $id );
		
		// echo count($this->data['row']);
		if (count($this->data['row'])==0) {
			$this->data['row']['id']	= "0";
			$this->data['row']['nama'] 	= "";
			$this->data['row']['jurusan'] 	= "";
		} else {
			//
		}
		
		$this->smarty->assign('data', $this->data);
		$this->smarty->display('admin/pages/lulus_form.tpl');
	}
	/* end here kelulusan */

	/* Alumni 230810 02:32 */
	function alumni($order='nama', $sort='desc', $page=1, $limit=20){
        $this->data['title'] 	.= " :: Alumni";

		$offset = $this->setPaging($page, $limit, $this->adminModel->getAlumni());
		$this->data['rows'] 	= $this->adminModel->getAlumni($order, $sort, $limit, $offset);
		$this->data['order']  	= $order;
		$this->data['sort']  	= $sort;
		$this->data['sort_id']  = "asc";

		$fields = array('id', 'nama',  'jurusan', 'lulus', 'angkatan');
		  
		foreach ($fields as $key=>$value) {
			$this->data['sort_'.$value]  = "none";
		}
 
		$this->smarty->assign('data', $this->data);
		$this->smarty->display('admin/pages/alumni.tpl');
	}
	
	function alumniForm($id=0, $order='id', $sort='asc', $page=1, $limit=10, $msg=""){
		$this->data['order'] 		= $order;
		$this->data['sort'] 		= $sort;
		$this->data['page'] 		= $page;
		$this->data['limit'] 		= $limit;
		$this->data['msg'] 			= $msg;

		$this->data['back']			= $this->site['site']."admin/alumni/$order/$sort/$page/$limit" ;
		$this->data['row'] 			= $this->adminModel->getAlumniForm( $id );
		
		// echo count($this->data['row']);
		if (count($this->data['row'])==0) {
			$this->data['row']['id']	= "0";
			$this->data['row']['nama'] 	= "";
			$this->data['row']['jurusan'] 	= "";
			$this->data['row']['lulus'] 	= "";
			$this->data['row']['angkatan'] 	= "";
		} else {
			//
		}
		
		$this->smarty->assign('data', $this->data);
		$this->smarty->display('admin/pages/alumni_form.tpl');
	}

	/* end here Alumni 230810 */ 

	/* Kalender Akademik */
	function kalender($order='id', $sort='asc', $page=1, $limit=20){
        $this->data['title']   .= " :: Kalender Akademik";

		$offset = $this->setPaging($page, $limit, $this->adminModel->getKalender());
		$this->data['rows'] 	= $this->adminModel->getKalender($order, $sort, $limit, $offset);
		$this->data['order']  	= $order;
		$this->data['sort']  	= $sort;
		$this->data['sort_id']  = "asc";

		$fields = array('id', 'title', 'fulltext', 'dateFrom', 'dateTo', 'state', 'file');
		  
		foreach ($fields as $key=>$value) {
			$this->data['sort_'.$value]  = "none";
		}
 
		$this->smarty->assign('data', $this->data);
		$this->smarty->display('admin/pages/kalender.tpl');
	}
	
	
	function kalenderForm($id=0, $order='id', $sort='asc', $page=1, $limit=10, $msg=""){
		$this->data['order'] 		= $order;
		$this->data['sort'] 		= $sort;
		$this->data['page'] 		= $page;
		$this->data['limit'] 		= $limit;
		$this->data['msg'] 			= $msg;

		$this->data['back']			= $this->site['site']."admin/kalender/$order/$sort/$page/$limit" ;
		$this->data['row'] 			= $this->adminModel->getKalenderForm( $id );
		
		// echo count($this->data['row']);
		if (count($this->data['row'])==0) {
			$this->data['row']['title'] 	= "";
			$this->data['row']['event'] 	= "";
			$this->data['row']['dateFrom'] 	= "";
			$this->data['row']['dateTo'] 	= "";
			$this->data['row']['state'] 	= "0";
			$this->data['row']['file'] 		= "";
		} else {
			//
		}
		
		$this->smarty->assign('data', $this->data);
		$this->smarty->display('admin/pages/kalender_form.tpl');
	}
	/* end here Kalender */ 
	
	
	/* Perpustakaan */
	function pustaka($order='id', $sort='asc', $page=1, $limit=20){
        $this->data['title']   .= " :: Perpustakaan";

		$offset = $this->setPaging($page, $limit, $this->adminModel->getPustaka());
		$this->data['rows'] 	= $this->adminModel->getPustaka($order, $sort, $limit, $offset);
		$this->data['order']  	= $order;
		$this->data['sort']  	= $sort;
		$this->data['sort_id']  = "asc";

		$fields = array('entrydate', 'title', 'author', 'publisher', 'year');
		
		foreach ($fields as $key=>$value) {
			$this->data['sort_'.$value]  = "none";
		}
 
		$this->smarty->assign('data', $this->data);
		$this->smarty->display('admin/pages/pustaka.tpl');
	}
	
	function pustakaForm($id=0, $order='id', $sort='asc', $page=1, $limit=10, $msg=""){
		$this->data['order'] 		= $order;
		$this->data['sort'] 		= $sort;
		$this->data['page'] 		= $page;
		$this->data['limit'] 		= $limit;
		$this->data['msg'] 			= $msg;

		$this->data['back']			= $this->site['site']."admin/pustaka/$order/$sort/$page/$limit" ;
		$this->data['row'] 			= $this->adminModel->getPustakaForm( $id );
		
		// echo count($this->data['row']);))
		if (count($this->data['row'])==0) {
			$this->data['row']['type'] 		= "buku";
			$this->data['row']['code'] 		= "";
			$this->data['row']['callNumber']= "";
			$this->data['row']['title'] 	= "";
			$this->data['row']['author'] 	= "";
			$this->data['row']['publisher'] = "";
			$this->data['row']['year'] 		= "";
			$this->data['row']['available'] = "";
			$this->data['row']['entrydate'] = "";
		} else {
			//
		}
		
		$this->smarty->assign('data', $this->data);
		$this->smarty->display('admin/pages/pustaka_form.tpl');
	}
	
	/*Pendaftaran*/
	function pendaftaran($order='ID', $sort='asc', $page=1, $limit=20, $msg=""){
        $this->data['title'] 	.= " :: Tabel Pendaftaran";

		$offset = $this->setPaging($page, $limit, $this->adminModel->getPendaftaran());
		$this->data['rows'] 	= $this->adminModel->getPendaftaran($order, $sort, $limit, $offset);
		$this->data['order']  = $order;
		$this->data['sort']  	= $sort;
		$this->data['page'] 	= $page;
		$this->data['limit'] 	= $limit;
		$this->data['sort_ID']  = "asc";

		$fields = array('no_pendaftaran', 'nama');
		  
		foreach ($fields as $key=>$value) {
			$this->data['sort_'.$value]  = "none";
		}
		
		$this->smarty->assign('data', $this->data);
		$this->smarty->assign("lokasi", 	$this->siteModel->getReffLokasi());
		//print_r($this->data);
		$this->smarty->display('admin/pages/pendaftaran.tpl');
	}
	
	function pendaftaranDetail($no_pendaftaran=0, $order='no_pendaftaran', $sort='asc', $page=1, $limit=50, $msg=""){
		$this->data['order'] 		= $order;
		$this->data['sort'] 		= $sort;
		$this->data['page'] 		= $page;
		$this->data['limit'] 		= $limit;
		$this->data['msg'] 			= $msg;

		$this->data['back']			= $this->site['site']."admin/pendaftaran/$order/$sort/$page/$limit" ;
		$this->data['row'] 			= $this->adminModel->getPendaftaranDetail( $no_pendaftaran );
		
		// echo count($this->data['row']);))
		if (count($this->data['row'])==0) {
			$this->data['row']['no_pendaftaran'] 		= "";
			$this->data['row']['nama'] 							= "";
			$this->data['row']['tempat_lahir']			= "";
			$this->data['row']['tgl_lahir'] 				= "";
			$this->data['row']['jenis_kelamin'] 		= "";
			$this->data['row']['tinggi_badan'] 			= "";
			$this->data['row']['agama']				 			= "";
			$this->data['row']['propinsi_smtaID'] 	= "";
			$this->data['row']['tahun_lulus'] 			= "";
			$this->data['row']['jenis_smtaID'] 			= "";
			$this->data['row']['jurusan_smtaID'] 		= "";
			$this->data['row']['jurusanID'] 				= "";
			$this->data['row']['lokasiID'] 					= "";
			$this->data['row']['mat_4'] 						= "";
			$this->data['row']['fisika_4'] 					= "";
			$this->data['row']['inggris_4'] 				= "";
			$this->data['row']['mat_5'] 						= "";
			$this->data['row']['fisika_5'] 					= "";
			$this->data['row']['inggris_5'] 				= "";
			$this->data['row']['mat_6'] 						= "";
			$this->data['row']['fisika_6'] 					= "";
			$this->data['row']['inggris_6'] 				= "";
			$this->data['row']['register_date']			= "";
			$this->data['row']['email'] 						= "";
			$this->data['row']['alamat'] 						= "";
			$this->data['row']['kodepos'] 					= "";
			$this->data['row']['telepon'] 					= "";
		} else {
			//
		}
		//print_r($this->data);
		$this->smarty->assign('data', $this->data);
		$this->smarty->display('admin/pages/pendaftaran_detail.tpl');
	}
	
	function pin($order='pinID', $sort='desc', $page=1, $limit=50, $msg=""){
		$this->data['title'] 	.= " :: Pin Register Generate";
		
		$offset = $this->setPaging($page, $limit, $this->adminModel->getPin());
		$this->data['rows'] 	= $this->adminModel->getPin($order, $sort, $limit, $offset);
		$this->data['order']  = $order;
		$this->data['sort']  	= $sort;
		$this->data['page'] 	= $page;
		$this->data['limit'] 	= $limit;
		$this->data['sort_pinID']  = "asc";

		$fields = array('pinID', 'pin', 'state', 'no_pendaftaran');
		  
			foreach ($fields as $key=>$value) {
				$this->data['sort_'.$value]  = "none";
			}
			//print_r($this->data);
			$this->smarty->assign('data', $this->data);
			$this->smarty->display('admin/pages/pin.tpl');
	}
	
}